bitkeeper revision 1.1236.1.24 (421f48ea99x29xFFaWbGuSxh3s_UYQ)
authormaf46@burn.cl.cam.ac.uk <maf46@burn.cl.cam.ac.uk>
Fri, 25 Feb 2005 15:48:58 +0000 (15:48 +0000)
committermaf46@burn.cl.cam.ac.uk <maf46@burn.cl.cam.ac.uk>
Fri, 25 Feb 2005 15:48:58 +0000 (15:48 +0000)
Minor VMX cleanups

Signed-off-by: michael.fetterman@cl.cam.ac.uk
xen/arch/x86/dom0_ops.c
xen/arch/x86/domain.c
xen/arch/x86/vmx_intercept.c
xen/arch/x86/vmx_io.c
xen/arch/x86/x86_32/traps.c
xen/include/asm-x86/shadow.h

index 3c11c8af6def2d16ef838cf8cb3e7bb66349984f..289085849cada0d9cad926f7541325b96f991c74 100644 (file)
@@ -349,8 +349,9 @@ void arch_getdomaininfo_ctxt(
 { 
     int i;
 #ifdef __i386__  /* Remove when x86_64 VMX is implemented */
-    unsigned long vmx_domain;
+#ifdef CONFIG_VMX
     extern void save_vmx_execution_context(execution_context_t *);
+#endif
 #endif
 
     c->flags = 0;
@@ -359,9 +360,10 @@ void arch_getdomaininfo_ctxt(
            sizeof(ed->arch.user_ctxt));
 
 #ifdef __i386__
-    vmx_domain = ed->arch.arch_vmx.flags;
-    if (vmx_domain)
+#ifdef CONFIG_VMX
+    if ( VMX_DOMAIN(ed) )
         save_vmx_execution_context(&c->cpu_ctxt);
+#endif
 #endif
 
     if ( test_bit(EDF_DONEFPUINIT, &ed->ed_flags) )
index d74d4cea4634e77603c1e00722e83aa37daef9a6..d3f2076cbe46378b8723e874ba0c509c572d6187 100644 (file)
@@ -723,9 +723,6 @@ void switch_to(struct exec_domain *prev_p, struct exec_domain *next_p)
     struct tss_struct *tss = init_tss + smp_processor_id();
     execution_context_t *stack_ec = get_execution_context();
     int i;
-#ifdef CONFIG_VMX
-    unsigned long vmx_domain = next_p->arch.arch_vmx.flags; 
-#endif
 
     __cli();
 
@@ -758,7 +755,7 @@ void switch_to(struct exec_domain *prev_p, struct exec_domain *next_p)
         }
 
 #ifdef CONFIG_VMX
-        if ( vmx_domain )
+        if ( VMX_DOMAIN(next_p) )
         {
             /* Switch page tables. */
             write_ptbase(next_p);
index d9299d5c223458dc2139659bd2035a2fa51959bd..0e30b85c42b360189520a8c2159ba93ea24dfb90 100644 (file)
@@ -29,6 +29,8 @@
 #include <xen/sched.h>
 #include <asm/current.h>
 
+#ifdef CONFIG_VMX
+
 /* for intercepting io request after vm_exit, return value: 0--not handle; 1--handled */
 int vmx_io_intercept(ioreq_t *p)
 {
@@ -264,3 +266,5 @@ void vmx_hooks_assist(struct exec_domain *d)
     }
 
 }
+
+#endif /* CONFIG_VMX */
index fcfe2ff36a7eaa669157e1b41269d9adc090b513..763c9d5d28cb1411dd03f83d7202cc9c270a7bba 100644 (file)
@@ -387,11 +387,11 @@ void vmx_intr_assist(struct exec_domain *d)
 
 void vmx_do_resume(struct exec_domain *d) 
 {
-    if ( d->arch.guest_vtable )
+    if ( test_bit(VMX_CPU_STATE_PG_ENABLED, &d->arch.arch_vmx.cpu_state) )
         __vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table));
     else
-        // we haven't switched off the 1:1 pagetable yet...
-        __vmwrite(GUEST_CR3, pagetable_val(d->arch.guest_table));
+        // paging is not enabled in the guest
+        __vmwrite(GUEST_CR3, pagetable_val(d->arch.phys_table));
 
     __vmwrite(HOST_CR3, pagetable_val(d->arch.monitor_table));
     __vmwrite(HOST_ESP, (unsigned long)get_stack_bottom());
index 42225967063aae442e3dae51a4261a17e99f13dd..244ef6bf706207708021dd4a4adebeafff3220eb 100644 (file)
@@ -96,7 +96,7 @@ void show_registers(struct xen_regs *regs)
     const char *context;
 
 #ifdef CONFIG_VMX
-    if ( current->arch.arch_vmx.flags && (regs->eflags == 0) )
+    if ( VMX_DOMAIN(current) && (regs->eflags == 0) )
     {
         __vmread(GUEST_EIP, &eip);
         __vmread(GUEST_ESP, &esp);
index 26b1a36b494b17532769bb2588b8cf2ce18a18b9..c02079fa8994722dff0c1733ee7966f339936567 100644 (file)
@@ -69,7 +69,7 @@ extern unsigned long shadow_l2_table(
     struct domain *d, unsigned long gmfn);
   
 static inline void shadow_invalidate(struct exec_domain *ed) {
-    if ( !ed->arch.arch_vmx.flags )
+    if ( !VMX_DOMAIN(ed) )
         BUG();
     memset(ed->arch.shadow_vtable, 0, PAGE_SIZE);
 }
@@ -766,7 +766,7 @@ static inline void __update_pagetables(struct exec_domain *ed)
             }
         }
 
-        if ( ed->arch.arch_vmx.flags )
+        if ( VMX_DOMAIN(ed) )
         {
             // Why is VMX mode doing this?
             shadow_invalidate(ed);
@@ -780,20 +780,22 @@ static inline void __update_pagetables(struct exec_domain *ed)
 
 static inline void update_pagetables(struct exec_domain *ed)
 {
-    if ( unlikely(shadow_mode_enabled(ed->domain)) )
+    struct domain *d = ed->domain;
+
+    if ( unlikely(shadow_mode_enabled(d)) )
     {
-        shadow_lock(ed->domain);
+        shadow_lock(d);
         __update_pagetables(ed);
-        shadow_unlock(ed->domain);
+        shadow_unlock(d);
     }
-    if ( !shadow_mode_external(ed->domain) )
+    if ( !shadow_mode_external(d) )
     {
 #ifdef __x86_64__
         if ( !(ed->arch.flags & TF_kernel_mode) )
             ed->arch.monitor_table = ed->arch.guest_table_user;
         else
 #endif
-        if ( shadow_mode_enabled(ed->domain) )
+        if ( shadow_mode_enabled(d) )
             ed->arch.monitor_table = ed->arch.shadow_table;
         else
             ed->arch.monitor_table = ed->arch.guest_table;